import request from 'umi-request';

export async function queryOrder(params) {
  return request('/api/ordOrders/selectByPage', {
    params,
  });
}


export async function queryOrderList(params) {
  return request('/api/ordOrders/selectOrderList', {
    params,
  });
}
export async function removeOrder(params) {
  return request(`/api/ordOrders/${params.orderId}`, {
    method: 'DELETE',
    data: { ...params},
  });
}
export async function finishOrder(params) {
  return request(`/api/ordOrders/finish`, {
    method: 'POST',
    data: { ...params},
  });
}
export async function refundOrder(params) {
  return request(`/api/ordOrders/refund`, {
    method: 'POST',
    data: { ...params},
  });
}
export async function deductOrder(params) {
  return request(`/api/ordOrders/deductByCust`, {
    method: 'POST',
    data: { ...params},
  });
}
export async function addOrder(params) {
  return request('/api/ordOrders', {
    method: 'POST',
    data: { ...params },
  });
}
export async function updateOrder(params) {
  return request('/api/ordOrders', {
    method: 'PUT',
    data: { ...params },
  });
}

export async function approvalOrder(params) {
  return request('/api/ordOrders/approval', {
    method: 'POST',
    data: { ...params },
  });
}

export async function engApprovalOrder(params) {
  return request('/api/ordOrders/engApproval', {
    method: 'POST',
    data: { ...params },
  });
}

export async function proApprovalOrder(params) {
  return request('/api/ordOrders/proApproval', {
    method: 'POST',
    data: { ...params },
  });
}

export async function engWorkOrder(params) {
  return request('/api/ordOrders/engWorkOrder', {
    method: 'POST',
    data: { ...params },
  });
}

export async function proWorkOrder(params) {
  return request('/api/ordOrders/proWorkOrder', {
    method: 'POST',
    data: { ...params },
  });
}

/**
 * 客户报废 返修 扣款
 * @param params
 * @returns {Promise<any>}
 */
export async function cstAfterSaleOrder(params) {
  return request('/api/ordAfterServices', {
    method: 'POST',
    data: { ...params },
  });
}

/**
 * 客户报废 返修 扣款
 * @param params
 * @returns {Promise<any>}
 */
export async function queryAfterSale(params) {
  return request('/api/ordAfterServices/selectByPage', {
    method: 'GET',
    params,
  });
}

/**
 * 查询出货订单
 * @param params
 * @returns {Promise<any>}
 */
export async function queryShipOrder(params) {
  return request('/api/ordOrders/selectShipOrderByPage', {
    params,
  });
}

/**
 * 查询评审信息
 * @param params
 * @returns {Promise<any>}
 */
export async function queryOrderReviewForm(params) {
  return request(`/api/ordOrders/queryReviewForm/${params.orderId}`, {
  });
}
